package com.agent.web;

import com.agent.entity.Role;
import com.agent.service.IRoleService;
import com.agent.util.ResponseData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by hg on 2019/1/16.
 */
@RequestMapping(value = "/role")
@Controller
public class RoleController {

    @Resource(name = "roleServicveImpl")
    IRoleService roleService;

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> list(){
        Role role = new Role();
        role.setEnabled(true);
        List<Role> roles = roleService.list(role);
        Map<String,Object> result =  ResponseData.getSuccessResult();
        result.put(ResponseData.DATA,roles);
        return result;

    }
}
